#!/bin/bash

if [ "$1" == "" ]; then
    echo "Usage: $0 <path>"
    echo ""
    echo "Replaces Eigen3 by Eigen recursively in all files in <path>."
    exit 1
fi

for f in $(grep -lr 'namespace Eigen3\|Eigen3::\|Eigen3/' $1 | grep -v '.svn'); do
    echo "Processing $f"
    sed -i -e 's/namespace Eigen3/namespace Eigen/g' $f
    sed -i -e 's/Eigen3::/Eigen::/g' $f
    sed -i -e 's/Eigen3\//Eigen\//g' $f
done
